#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int GetWordNum(char st[])
{
	int i = 0, c = 0, d = 0, e = 0;
	while (st[i] != 0)
	{
		if (st[0] == ' ')
		{
			d = 0;
			e = 0;
			while (st[i] == ' ')
			{
				i++;
				d = 2;
			}
			if (d == 2)
				e++;
			while (st[i] != ' ' && st[i] != 0)
			{
				i++;
				d = 1;
			}
			if (d == 1)
				e++;
			if (e == 2)
				c++;
		}
		else
		{
			while (st[i] != ' ' && st[i] != 0)
			{
				i++;
			}
			while (st[i] == ' ')
			{
				i++;
			}
			c++;
		}
	}
	return c;
}
int main()
{
	char a[100];
	int b;
	gets(a);
	b = GetWordNum(a);
	printf("%d", b);
	return 0;
}